package com.etxxy.common.util;

import org.apache.commons.lang.RandomStringUtils;

/**
 * @category 随机生成器
 * @author yiz
 *
 */
public class RandomWordsUtil {

	public static String getRandom(int len) {

		StringBuffer buf = new StringBuffer("=,a,b,c,d,e,f,g,h,i,g,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z");
		buf.append(",A,B,C,D,E,F,G,H,I,G,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
		buf.append(",1,2,3,4,5,6,7,8,9,0");
		String[] arr = buf.toString().split(",");
		int k;
		java.util.Random r;
		StringBuffer b = new StringBuffer();
		for (int i = 0; i < len; i++) {
			r = new java.util.Random();
			k = r.nextInt();
			b.append(String.valueOf(arr[Math.abs(k % 61)]));
		}
		return b.toString();
	}

	/**
	 * @category 生成随机数字，固定长度
	 * @param count
	 * @return
	 */
	public static String randomNumeric(int count) {
		return RandomStringUtils.randomNumeric(count);
	}

	public static void main(String[] args) {
		System.out.println(randomNumeric(10));
	}
}
